<template>
  <div>
    <div class="ser">
      <h3>最新提交记录</h3>
      <ul>
        <li v-for="item in uplist" :key="item.push_time">
          <span><i class="iconfont icon-up"></i>{{new Date(item.push_time-0)|dataFormat('YYYY-MM-DD HH:mm:ss')}}</span>
          <span>{{item.test_name}}</span>
        </li>
      </ul>
    </div>

    <div class="uploadp">
      <router-link to="/uploadProject" tag="a">
        <el-button style="width:120px" type="primary">上传<i class="el-icon-upload el-icon--right"></i></el-button>
      </router-link>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      user: {},
      uplist: [],
    };
  },

  created() {
   
    this.user = JSON.parse(window.sessionStorage.getItem("user"));
     this.getupjl();
  },
  methods: {

    //获取上传记录列表
    async getupjl() {
      let data = await this.$http.get(`userCenter/getupgardjl?user_id=${this.user._id}`);
      // console.log(data.data)
      if (data.status == 200) {

        this.uplist = data.data.datalist
        

      } else {
        this.$message.error("获取上传列表失败，刷新重试");
      }
    },
  },
};
</script>

<style lang="less" scoped>
h3 {
  height: 100px;
  line-height: 100px;
}
.ser {
  min-height: 400px;
  padding: 20px;
  li {
    height: 50px;
    line-height: 50px;
    display: flex;
    span {
		flex: 1;
		display:block;   
		overflow:hidden;
		white-space:nowrap;
		text-overflow:ellipsis;
      &:nth-of-type(2){
		  flex: 2;
	  }
    }
  }
}
.uploadp {
  height: 50px;
  line-height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
}
</style>